// 模拟京东商品
import type { ProductItem } from "@/api/types/product";

function generateBatchRandomNumbers(count: number) {
  const numbers = new Array(count);
  for (let i = 0; i < count; i++) {
    numbers[i] = Math.floor(Math.random() * 1000000 + 100) / 100;
  }
  return numbers;
}

export const product = [
  {
    id: 1,
    name: "联想拯救者R9000P 2025 AI元启游戏笔记本电脑(锐龙9 8945HX 32G1T RTX5070 2.5K240Hz 黑)国家补贴20%",
    price: 4488.15,
    description: "超感光徕卡四摄 5G手机",
    thumbnail:
      "https://img11.360buyimg.com/babel/s240x240_jfs/t1/283559/26/4558/21695/67d92f26F7e6be065/37130674aaabdc7f.jpg.avif",
    category: "手机",
    stock: 100,
    soldNum: 1000,
    saleTags: "自营",
    tags: ["超感光", "徕卡", "四摄", "5G", "手机"],
    skus: [
      {
        id: 1,
        sku_name: "1",
        price: 360.25,
        thumbnail:
          "https://img11.360buyimg.com/n2/s480x480_jfs/t1/328434/8/15284/265529/68b7bfb7Fa96f1a63/3934067fe96488b0.jpg",
      },
      {
        id: 2,
        sku_name: "2",
        price: 120.35,
        thumbnail:
          "https://img14.360buyimg.com/n2/s480x480_jfs/t1/319373/8/13385/43348/6864f346Fd2fe97e6/637baec8aa942dad.jpg.avif",
      },
      {
        id: 3,
        sku_name: "3",
        price: 120,
        thumbnail:
          "https://img11.360buyimg.com/n2/s480x480_jfs/t1/328434/8/15284/265529/68b7bfb7Fa96f1a63/3934067fe96488b0.jpg",
      },
      {
        id: 4,
        sku_name: "4",
        price: 1600,
        thumbnail:
          "https://img14.360buyimg.com/n2/s480x480_jfs/t1/319373/8/13385/43348/6864f346Fd2fe97e6/637baec8aa942dad.jpg.avif",
      },
    ],
    hot: true, // 热门
  },
  {
    id: 2,
    name: "Apple/苹果 iPhone 14 (A2884) 128GB 蓝色 支持移动联通电信5G 双卡双待手机",
    price: 999.15,
    description: "骁龙8 Gen 2 5G手机",
    thumbnail:
      "https://img11.360buyimg.com/babel/s240x240_jfs/t1/283559/26/4558/21695/67d92f26F7e6be065/37130674aaabdc7f.jpg.avif",
    category: "手机",
    stock: 100,
    soldNum: 500,
    saleTags: "自营",
    tags: ["超感光", "徕卡", "四摄", "5G", "手机"],
    skus: [
      {
        id: 1,
        name: "1",
        price: 7900.35,
        thumbnail:
          "https://img11.360buyimg.com/n2/s480x480_jfs/t1/328434/8/15284/265529/68b7bfb7Fa96f1a63/3934067fe96488b0.jpg",
      },
      {
        id: 2,
        name: "2",
        price: 120,
        thumbnail:
          "https://img11.360buyimg.com/n2/s480x480_jfs/t1/318036/28/22825/96464/689448ccFb57adee5/41f2756787dae65b.jpg.avif",
      },
      {
        id: 3,
        name: "3",
        price: 120,
        thumbnail:
          "https://img11.360buyimg.com/n2/s480x480_jfs/t1/328434/8/15284/265529/68b7bfb7Fa96f1a63/3934067fe96488b0.jpg",
      },
      {
        id: 4,
        name: "4",
        price: 190,
        thumbnail:
          "https://img11.360buyimg.com/n2/s480x480_jfs/t1/318036/28/22825/96464/689448ccFb57adee5/41f2756787dae65b.jpg.avif",
      },
    ],
    hot: true, // 热门
  },
  {
    id: 3,
    name: "联想拯救者R9000P 2025 AI元启游戏笔记本电脑(锐龙9 8945HX 32G1T RTX5070 2.5K240Hz 黑)国家补贴20%",
    price: 2999.15,
    description: "骁龙8 Gen 2 5G手机",
    thumbnail:
      "https://img13.360buyimg.com/babel/s240x240_jfs/t1/315602/1/2968/27130/682e76a2Ff8c6e93d/f03c06d26ac3d948.jpg.avif",
    category: "手机",
    stock: 100,
    soldNum: 1600,
    saleTags: "自营",
    tags: ["超感光", "徕卡", "四摄", "5G", "手机"],
    skus: [
      {
        id: 2,
        name: "2",
        price: 120.5,
        thumbnail:
          "https://img14.360buyimg.com/n2/s480x480_jfs/t1/292504/36/18826/23284/688c7292F72146ab4/c8e6e86ae7468258.jpg.avif",
      },
      {
        id: 3,
        name: "3",
        price: 120,
        thumbnail:
          "https://img11.360buyimg.com/n2/s480x480_jfs/t1/328434/8/15284/265529/68b7bfb7Fa96f1a63/3934067fe96488b0.jpg",
      },
      {
        id: 4,
        name: "4",
        price: 120,
        thumbnail:
          "https://img14.360buyimg.com/n2/s480x480_jfs/t1/292504/36/18826/23284/688c7292F72146ab4/c8e6e86ae7468258.jpg.avif",
      },
    ],
    hot: true, // 热门
  },
  {
    id: 4,
    name: "Apple/苹果 iPhone 14 (A2884) 128GB 蓝色 支持移动联通电信5G 双卡双待手机",
    price: 999.64,
    description: "骁龙8 Gen 2 5G手机",
    thumbnail:
      "https://img11.360buyimg.com/babel/s240x240_jfs/t1/283559/26/4558/21695/67d92f26F7e6be065/37130674aaabdc7f.jpg.avif",
    category: "手机",
    stock: 100,
    soldNum: 300,
    saleTags: "自营",
    tags: ["超感光", "徕卡", "四摄", "5G", "手机"],
    skus: [],
    hot: true, // 热门
  },
  {
    id: 5,
    name: "西部数据（WD）SSD固态硬盘 NVMe M.2接口 AI电脑配件 笔记本电脑游戏硬盘 原厂颗粒不虚标不掉速 SN5000 | PCle4x4 5150MB/s 大容量 【1TB】",
    price: 5999,
    description: "骁龙8 Gen 2 5G手机",
    thumbnail:
      "https://img30.360buyimg.com/babel/s240x240_jfs/t1/191290/13/41603/39811/6538fd88F9a72a7c5/bbe72eeb558a42bf.jpg.avif",
    category: "手机",
    stock: 100,
    soldNum: 2000,
    saleTags: "自营",
    tags: ["超感光", "徕卡", "四摄", "5G", "手机"],
    skus: [
      {
        id: 1,
        name: "1",
        price: 120.56,
        thumbnail:
          "https://img11.360buyimg.com/n2/s480x480_jfs/t1/328434/8/15284/265529/68b7bfb7Fa96f1a63/3934067fe96488b0.jpg",
      },
      {
        id: 2,
        name: "2",
        price: 120,
        thumbnail:
          "https://img14.360buyimg.com/n2/s480x480_jfs/t1/292504/36/18826/23284/688c7292F72146ab4/c8e6e86ae7468258.jpg.avif",
      },
      {
        id: 4,
        name: "4",
        price: 120,
        thumbnail:
          "https://img11.360buyimg.com/n2/s480x480_jfs/t1/328434/8/15284/265529/68b7bfb7Fa96f1a63/3934067fe96488b0.jpg",
      },
    ],
    hot: true, // 热门
  },
  {
    id: 6,
    name: "大疆 【国家补贴】Osmo Action 5 Pro 畅拍套装 超旗舰画质运动相机 户外摩托骑行潜水徒步vlog相机  ",
    price: 5999,
    description: "骁龙8 Gen 2 5G手机",
    thumbnail:
      "https://img14.360buyimg.com/babel/s240x240_jfs/t1/37195/24/21969/12392/66bdb221F03d82604/dc4e328e65378757.jpg.avif",
    category: "手机",
    stock: 100,
    soldNum: 2300,
    saleTags: "自营",
    tags: ["超感光", "徕卡", "四摄", "5G", "手机"],
    skus: [
      {
        id: 1,
        name: "1",
        price: 120,
        thumbnail:
          "https://img11.360buyimg.com/n2/s480x480_jfs/t1/328434/8/15284/265529/68b7bfb7Fa96f1a63/3934067fe96488b0.jpg",
      },
      {
        id: 2,
        name: "2",
        price: 260.32,
        thumbnail:
          "https://img14.360buyimg.com/n2/s480x480_jfs/t1/292504/36/18826/23284/688c7292F72146ab4/c8e6e86ae7468258.jpg.avif",
      },
      {
        id: 3,
        name: "3",
        price: 120,
        thumbnail:
          "https://img11.360buyimg.com/jdcms/s240x240_jfs/t1/280393/24/16278/42651/67f3da64F092a4b59/49ad603a8e780a34.jpg.avif",
      },
    ],
    hot: true, // 热门
  },
  {
    id: 7,
    name: "大疆 【国家补贴】Osmo Action 5 Pro 超旗舰画质运动相机 户外摩托骑行潜水徒步vlog便携式4K摄像机 标准套装 官方标配 无内存卡",
    price: 5999,
    description: "骁龙8 Gen 2 5G手机",
    thumbnail:
      "https://img11.360buyimg.com/jdcms/s240x240_jfs/t1/280393/24/16278/42651/67f3da64F092a4b59/49ad603a8e780a34.jpg.avif",
    category: "手机",
    stock: 100,
    soldNum: 1000,
    saleTags: "自营",
    tags: ["超感光", "徕卡", "四摄", "5G", "手机"],
    skus: [
      {
        id: 1,
        name: "1",
        price: 120,
        thumbnail:
          "https://img11.360buyimg.com/n2/s480x480_jfs/t1/328434/8/15284/265529/68b7bfb7Fa96f1a63/3934067fe96488b0.jpg",
      },
      {
        id: 3,
        name: "3",
        price: 350,
        thumbnail:
          "https://img14.360buyimg.com/n2/s480x480_jfs/t1/292504/36/18826/23284/688c7292F72146ab4/c8e6e86ae7468258.jpg.avif",
      },
      {
        id: 4,
        name: "4",
        price: 120,
        thumbnail:
          "https://img11.360buyimg.com/n2/s480x480_jfs/t1/328434/8/15284/265529/68b7bfb7Fa96f1a63/3934067fe96488b0.jpg",
      },
    ],
    hot: true, // 热门
  },
];

const recommend: any[] = [
  {
    id: 1,
    name: "新款山地自行车变速车26寸减震碟刹青少年成人变速山地车学生赛车 暗夜黑 21速 26寸 26寸",
    price: 120,
    thumbnail:
      "//img11.360buyimg.com/n1/s170x170_jfs/t20260916/348116/22/3912/485942/68c8f5aaF92f30b5d/c9e2a7e8d00d064d.png",
  },
  {
    id: 2,
    name: "新款山地自行车变速车26寸减震碟刹青少年成人变速山地车学生赛车 暗夜黑 21速 26寸 26寸",
    price: 120,
    thumbnail:
      "//img11.360buyimg.com/n1/s170x170_jfs/t20260916/348116/22/3912/485942/68c8f5aaF92f30b5d/c9e2a7e8d00d064d.png",
  },
  {
    id: 3,
    name: "新款山地自行车变速车26寸减震碟刹青少年成人变速山地车学生赛车 暗夜黑 21速 26寸 26寸",
    price: 120,
    thumbnail:
      "//img11.360buyimg.com/n1/s170x170_jfs/t20260916/348116/22/3912/485942/68c8f5aaF92f30b5d/c9e2a7e8d00d064d.png",
  },
  {
    id: 4,
    name: "新款山地自行车变速车26寸减震碟刹青少年成人变速山地车学生赛车 暗夜黑 21速 26寸 26寸",
    price: 120,
    thumbnail:
      "//img11.360buyimg.com/n1/s170x170_jfs/t20260916/348116/22/3912/485942/68c8f5aaF92f30b5d/c9e2a7e8d00d064d.png",
  }
];

// 根据上面的模拟数据生成10000个随机组合的模拟商品
export const generateProducts = (n: number) => {
  const products = [];
  const len = product.length;
  for (let i = 0; i < n; i++) {
    // 生成1~5的随机数
    const randomNum = Math.floor(Math.random() * (len - 1)) + 1;
    products.push({ ...product[randomNum], id: i });
  }
  return products;
};

export const generateRecomments = (n: number) => {
  const recommends = [];
  const len = recommend.length;
  for (let i = 0; i < n; i++) {
    // 生成1~5的随机数
    const randomNum = Math.floor(Math.random() * (len - 1)) + 1;
    recommends.push({ ...recommend[randomNum], id: i });
  }

  return recommends;
};
